package com.suredy.app.porject.constants;

import java.util.ArrayList;
import java.util.List;

/**
 * 合同类型
 * 
 * @author VIVID.G
 * @since 2015-10-15
 * @version v0.1
 */
public enum ContractType {

	// 以下是主合同
	MAIN("主合同", true),

	A_CONTRACT("付款合同", false),

	B_CONTRACT("收款合同", true),

	// 以下是子合同
	TASK_CONTRACT("生产经营任务书", false),

	MATERIAL_CONTRACT("材料采购合同", false),

	SUB_SERVICE_CONTRACT("劳务分包合同", false),

	SUB_PROFESSIONAL_CONTRACT("专业分包合同", false),

	AGREEMENT_CONTRACT("补充协议", false);

	private String value;
	private boolean collection;

	public final static ContractType[] MAIN_CONTRACT_TYPES;
	public final static ContractType[] SUB_CONTRACT_TYPES;
	public final static ContractType[] JHGLZZ_CONTRACT_TYPES;
	public final static ContractType[] CGGLZZ_CONTRACT_TYPES;

	public final static List<ContractType> IN_MONEY_CONTRACT_TYPE = new ArrayList<ContractType>(); // 收款合同
	public final static List<ContractType> OUT_MONEY_CONTRACT_TYPE = new ArrayList<ContractType>(); // 付款合同

	static {
		MAIN_CONTRACT_TYPES = new ContractType[] {MAIN, A_CONTRACT, B_CONTRACT};
		SUB_CONTRACT_TYPES = new ContractType[] {TASK_CONTRACT, MATERIAL_CONTRACT, SUB_SERVICE_CONTRACT, SUB_PROFESSIONAL_CONTRACT};
		JHGLZZ_CONTRACT_TYPES = new ContractType[] {TASK_CONTRACT, SUB_SERVICE_CONTRACT, SUB_PROFESSIONAL_CONTRACT};
		CGGLZZ_CONTRACT_TYPES = new ContractType[] {MATERIAL_CONTRACT};

		for (ContractType t : ContractType.values()) {
			if (t.isCollection())
				IN_MONEY_CONTRACT_TYPE.add(t);
			else
				OUT_MONEY_CONTRACT_TYPE.add(t);
		}
	}

	private ContractType(String value, boolean collection) {
		this.value = value;
		this.collection = collection;
	}

	public String getValue() {
		return value;
	}

	public boolean isCollection() {
		return collection;
	}

}
